import {VCairnEvent} from "./VCairnEvent";
import eventBus from '../core/EventDispatcher';

export class VCairnController {

    addEvent(eventType:string, handler: (data:any) => void) {
        eventBus.on(eventType, handler);
    }

    removeEvent(eventType:string, handler: (data:any) => void) {
        eventBus.off(eventType, handler);
    }

    fireEvent(eventType:string, data?: any) {
        eventBus.emit(new VCairnEvent(eventType, data));
    }

    get eventBus() { return eventBus; }

}